﻿// <copyright file="ProgressForm.cs" company="Horiba Medical">
//     Copyright (c) Horiba Medical. All rights reserved.
// </copyright>
// <summary>
//     Provides a form capable of displaying and updating a progress bar.
// </summary>

namespace DoxyOutParser.Forms
{
	using System.Windows.Forms;

	/// <summary>
	/// Provides an updatable progress form (Code part).
	/// </summary>
	public partial class ProgressForm : Form
	{
		/// <summary>
		/// Initializes a new instance of the ProgressForm class.
		/// </summary>
		public ProgressForm()
		{
			this.InitializeComponent();
			this.CenterToScreen();
		}

		/// <summary>
		/// Sets the label on the progress form.
		/// </summary>
		/// <param name="text">The text to display.</param>
		public void SetLabel(string text)
		{
			this.labelProgress.Text = text;
		}

		/// <summary>
		/// Set the size of the steps on the progress bar.
		/// </summary>
		/// <param name="step">Step size (from 1 to 100).</param>
		public void SetProgressStep(int step)
		{
			this.progressBar.Step = step;
		}

		/// <summary>
		/// Go on one step on the progress bar.
		/// </summary>
		public void UpdateProgression()
		{
			this.progressBar.PerformStep();
			this.labelProgress.Refresh();
		}

		/// <summary>
		/// Go on one step on the progress bar (and update the label text).
		/// </summary>
		/// <param name="labelText">Text to display.</param>
		public void UpdateProgression(string labelText)
		{
			this.SetLabel(labelText);
			this.progressBar.PerformStep();
			this.labelProgress.Refresh();
		}
	}
}
